import request from '@/utils/request'

// 获取工单列表
export function getWorkOrderList(params) {
  return request({
    url: '/api/work-orders',
    method: 'get',
    params
  })
}

// 新增工单
export function addWorkOrder(data) {
  return request({
    url: '/api/work-orders',
    method: 'post',
    data
  })
}

// 更新工单
export function updateWorkOrder(data) {
  return request({
    url: `/api/work-orders/${data.id}`,
    method: 'put',
    data
  })
}

// 删除工单
export function deleteWorkOrder(id) {
  return request({
    url: `/api/work-orders/${id}`,
    method: 'delete'
  })
}

// 更新工单状态
export function updateWorkOrderStatus(id, status) {
  return request({
    url: `/api/work-orders/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// 分配工单
export function assignWorkOrder(id, assigneeId) {
  return request({
    url: `/api/work-orders/${id}/assign`,
    method: 'put',
    data: { assigneeId }
  })
} 